def rotate(nums, k):
    k %= len(nums)
    nums[:] = nums[-k:] + nums[:-k]
    return nums

nums = [1, 2, 3, 4, 5, 6, 7]
k = 3   # 0-3下标的数字放在最后
print(rotate(nums, k))
